<extend name="Public/base" />

<block name="body">
    <!-- 标题栏 -->
    <div class="main-title">
        <h2>{$title}</h2>
    </div>
    <div class="cf">
        <div class="fl">
            <a class="btn" href="{:U('Material/addpname',array('belong_to'=>$belong_to))}">新 增</a>
        </div>
        <div class="tools auth-botton">
            <a url="{:U('changestatus',array('method'=>'resume','table'=>'material_pname'))}" class="btn ajax-post" target-form="ids" >启 用</a>
            <a url="{:U('changestatus',array('method'=>'forbid','table'=>'material_pname'))}" class="btn ajax-post" target-form="ids" >禁 用</a>
        </div>
    </div>


    <!-- 数据列表 -->
    <div class="data-table table-striped">
	<table>
        <thead>
        <tr>
            <th class="row-selected row-selected"><input class="check-all" type="checkbox"/></th>
            <th>编号</th>
            <th>商品名</th>
            <th>水果分类</th>
            <th>状态</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        <notempty name="_list">
            <volist name="_list" id="vo">
                <tr>
                    <td><input  type="checkbox" class="ids" name="id[]" value="{$vo.id}" /></td>
                    <td>
                        <a class="" href="{:U('Inventory/inventoryrealtime')}&BIN=_{:I('belong_to')}{$vo.pname_no}__">{$vo.pname_no}</a>

                    </td>
                    <td>{$vo.pname}</td>
                    <td>{$vo.belong_to|get_name_by_id=###,'material_fruitclassify','fruit_classify_no','fruit_classify'}</td>
                    <td>{$vo.status|get_material_status}</td>
                    <td>
                        <if condition="UID eq 1">
                            <a class="btn btn-danger ajax-get confirm" href="{:U('Material/delpname')}&BIN=_{:I('belong_to')}{$vo.pname_no}__&id={$vo.id}">删除</a>
                        </if>
                    </td>
                </tr>
            </volist>
            <else/>
            <td colspan="9" class="text-center"> aOh! 暂时还没有内容! </td>
        </notempty>
        </tbody>
    </table>
	</div>
    <div class="page">
        {$_page}
    </div>
</block>

<block name="script">
    <script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>

    <script type="text/javascript">
        //搜索功能
	$("#search").click(function(){
		var url = $(this).attr('url');
        var query  = $('.search-form').find('input').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
        query = query.replace(/^&/g,'');
        if( url.indexOf('?')>0 ){
            url += '&' + query;
        }else{
            url += '?' + query;
        }
		window.location.href = url;
	});
	//回车搜索
	$(".search-input").keyup(function(e){
		if(e.keyCode === 13){
			$("#search").click();
			return false;
		}
	});
        
        //导航高亮
        highlight_subnav('{:U('Material/fruitclassifymanage')}');
    </script>
</block>
